package ooday04;

public class Test {
    public static void main(String[] args) {
       Animal[] animals=new Animal[5];
       animals[0]=new Dog("啸天",6966,"黑白斑点");
       animals[1]=new Dog("谛听",71,"黑");
       animals[2]=new Chick("肯德",3459,"金黄酥脆");
       animals[3]=new Chick("五色神",2567,"金黄酥脆");
       animals[4]=new Fish("",6,"");

       for(int i=0;i<animals.length;i++){
           System.out.println(animals[i].name);
           animals[i].eat();
           animals[i].drinkWater();
           if(animals[i]instanceof Dog){
               Dog dog=(Dog) animals[i];
               dog.eat();
               dog.lookHome();
               dog.swim();
           }
           if(animals[i]instanceof Fish){
               Fish fish=(Fish) animals[i];
               fish.swim();
           }
           if(animals[i]instanceof Chick){
               Chick chick=(Chick) animals[i];

           }
       }
     /*  Master master=new Master();
       Dog dog =new Dog("啸天",6966,"黑白斑点");
       Fish fish=new Fish("肯德",3459,"金黄酥脆");
       Chick chick=new Chick("",6,"");
       master.feed(dog);
       master.feed(chick);
       master.feed(fish);*/
        Animal a=new Dog("",9,"");
        Dog b=(Dog) a;
        Swim c=(Swim) a;





    }
}
